package com.allwees.bs.module.oms.mq.listener;

import com.allwees.bs.module.oms.service.GeneralOmsOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RabbitListener(queues = "q.C.Order.Payed")
public class OrderPayedListener {

    @Autowired
    private GeneralOmsOrderService generalOmsOrderService;

    @RabbitHandler
    public void onEvent(String orderUuid) {
        log.info("=================mq order payed: {} ", orderUuid);
        generalOmsOrderService.create(orderUuid);
    }
}
